<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!-- Meta, title, CSS, favicons, etc. -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>登录</title>

    <!-- Bootstrap -->
    <link href="/vendors/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome -->
    <link href="/vendors/font-awesome/css/font-awesome.min.css" rel="stylesheet">
    <!-- NProgress -->
    <link href="/vendors/nprogress/nprogress.css" rel="stylesheet">
    <!-- Animate.css -->
    <link href="/vendors/animate.css/animate.min.css" rel="stylesheet">

    <!-- Custom Theme Style -->
    <link href="/build/css/custom.min.css" rel="stylesheet">
</head>

<body class="login">
<div>
    <a class="hiddenanchor" id="signup"></a>
    <a class="hiddenanchor" id="signin"></a>

    <div class="login_wrapper">
        <div class="animate form login_form">
            <section class="login_content">
                <form method="post" action="/submit_login_data">
                    <h1>登录</h1>
                    <div>
                        <input type="text" name="phone" class="form-control" placeholder="手机号码" required="" />
                    </div>
                    <div>
                        <input type="password" name="password" class="form-control" placeholder="密码" required="" />
                    </div>
                    <div>
                        <input class="btn btn-default" type="submit" name="submit" value="登录" />
                        <a class="reset_pass" href="#">忘记密码?</a>
                    </div>

                    <div class="clearfix"></div>

                    <div class="separator">
                        {{--<p class="change_link">New to site?--}}
                            {{--<a href="#signup" class="to_register"> Create Account </a>--}}
                        {{--</p>--}}

                        <div class="clearfix"></div>
                        <br />

                        <div>
                            {{--<h1><i class="fa fa-paw"></i> 国能中心!</h1>--}}
                            <p>© 国家城市能源计量中心（江西）</p>
                        </div>
                    </div>
                </form>
            </section>
        </div>

    </div>
</div>
<script src="/vendors/jquery/dist/jquery.min.js"></script>
<script>
    var phone = $("input[name='phone']").val();
    var password = $("input[name='password']").val();
    $(".submit").click(function () {
        $.ajax({
            url : '/submit_login_data',
            data: {
                phone: phone,
                password:password
            },
            type:'post',
            dataType:'json',
            success:function(data){
                if(data.status == 'failed') {
                    $(".content").html(data.message);
                    $(".content").css("display:block");
                    return false;
                } else {
                    window.location.href = "/index";
                }
            },
            error: function(XMLHttpRequest, textStatus, errorThrown) {

            }
        });
    })
</script>
</body>
</html>
